1. Field
The present application relates generally to an improved data processing apparatus and method, and more specifically, to mechanisms for selecting a hardware assist thread from a pool of available threads to improve the efficiency of the dynamic profiling of a main thread.
2. Description of the Related Art
Profiling is an investigation of the behavior of a computer program. The behavior is monitored using information gathered during the operation of the program. Profiling is done to determine which sections of a program may be optimized to increase the speed of the program and/or decrease the program's memory requirements. Programs perform profiling to count events such as, but not limited to, cache misses, branch mispredicts, instruction mixes, and other events. Profiling data may indicate how long it takes to process different instructions and how long the program spends in different areas of the program. Profiling data may be used to optimize the program by removing unnecessary instructions or rearranging instructions to process the program more quickly.
In modern processor architectures and configurations, the concept of multi-threaded processing has been introduced. A thread of execution, or simply a “thread”, typically results from a fork in the execution of a computer program into two or more concurrently running tasks, such as at a loop where some iterations are performed by one thread and other iterations are performed by one or more other threads, or branch instructions where the various possible branches are executed by different threads.
The implementation of threads and processes differs from one operating system to another, but in most cases, a thread is contained inside a process. Multiple threads can exist within the same process and share resources, such as memory, while different processes may not share these resources. When a program is profiling, the thread of execution must stall while profiling is performed. When a program is profiling multiple times or throughout the program, the thread of execution may be stalled many times.